import projectConfig from '@/common/config.js';
import store from '@/store';
import {
	mapState
} from 'vuex';
export default {
	data() {
		return {
			assetsPath: projectConfig.assetsPath || '/static',
			fileUrl: projectConfig.fileUrl
		}
	},
	computed: {
		...mapState(['skin', 'appName']),
		themeColor: {
			get() {
				return store.state.themeColor;
			},
			set(val) {
				store.state.themeColor = val;
			}
		},

	},
	onLoad() {
		wx.setNavigationBarTitle({
			title: this.appName
		});
	},
	methods: {
		/* 获取屏幕宽高，用于定位新增按钮的初始位置*/
		getAddPosition() {
			uni.getSystemInfo({
				success: (res) => {
					let width = res.windowWidth //获取系统信息，可使用窗口的宽度
					let height = res.screenHeight //获取系统信息，可使用窗口的高度
					console.log(height)
					let addY = uni.upx2px((height - (125 / 2))) / 2;
					let addX = width;

					this.updateAddPosition({
						x: addX,
						y: addY
					})
				}
			});
		},
		domData: function(t, n) {
			var o = this;
			this.$nextTick(function() {
				uni
					.createSelectorQuery()
					.in(o)
					.selectAll(t)
					.boundingClientRect()
					.exec(function(e) {
						n(e[0]);
					});
			});
		},
	}
}